﻿/*
Plugin=CustomPlugin_BrowserSwith
Name1=浏览器切换
Command1=CustomPlugin_BrowserSwith
Version=1.0
*/
CustomPlugin_BrowserSwith_Msedge(){
	;获取当前浏览器
	CurWinClass:=QZData("winclass") ;将获取的class名赋值给用户变量
	Curhwnd:=QZData("hWnd")
	WinActivate,Ahk_ID %Curhwnd%
	sleep,100
	if (CurWinClass="MozillaWindowClass") or (CurWinClass="QQBrowser_WidgetWin_1") or (CurWinClass="Chrome_WidgetWin_1") ;如果当前激活窗口为资源管理器
	{
		OldCP:=Clipboard
		sendinput,^{l}
		sleep,100
		sendinput,^c
		sleep,100
	}
	if (CurWinClass="Chrome_WidgetWin_1") {
		AppPath:=QZData("%Msedge%")
		run,%AppPath%
		sleep,100
		WinWaitActive,ahk_class Chrome_WidgetWin_1,,5
		sendinput,^{l}
		sleep,100
		sendinput,^v
		sleep,100
		sendinput,{enter}
		sleep,100
		Clipboard:=OldCP
	return
	}
}
; CustomPlugin_BrowserSwith_Centbrowser(){
; 	;获取当前浏览器
; 	CurWinClass:=QZData("winclass") ;将获取的class名赋值给用户变量
; 	Curhwnd:=QZData("hWnd")
; 	WinActivate,Ahk_ID %Curhwnd%
; 	sleep,100
; 	if (CurWinClass="MozillaWindowClass") or (CurWinClass="QQBrowser_WidgetWin_1") or (CurWinClass="Chrome_WidgetWin_1") ;如果当前激活窗口为资源管理器
; 	{
; 		OldCP:=Clipboard
; 		sendinput,^{l}
; 		sleep,200
; 		sendinput,^c
; 		sleep,200
; 	}
; 	if (CurWinClass="Chrome_WidgetWin_1") {
; 		AppPath:=QZData("%Centbrowser%")
; 		run,%AppPath%
; 		sleep,2000
; 		WinWaitActive,ahk_class Chrome_WidgetWin_1,,5
; 		sendinput,^{l}
; 		sleep,200
; 		sendinput,^v
; 		sleep,200
; 		sendinput,{enter}
; 		sleep,200
; 		Clipboard:=OldCP
; 	return
; 	}		
; }
CustomPlugin_BrowserSwith_GoogleChrome(){
	;获取当前浏览器
	CurWinClass:=QZData("winclass") ;将获取的class名赋值给用户变量
	Curhwnd:=QZData("hWnd")
	WinActivate,Ahk_ID %Curhwnd%
	sleep,100
	if (CurWinClass="MozillaWindowClass") or (CurWinClass="QQBrowser_WidgetWin_1") or (CurWinClass="Chrome_WidgetWin_1") ;如果当前激活窗口为资源管理器
	{
		OldCP:=Clipboard
		sendinput,^{l}
		sleep,100
		sendinput,^c
		sleep,100
	}
	if (CurWinClass="Chrome_WidgetWin_1") {
		AppPath:=QZData("%GoogleChrome%")
		run,%AppPath%
		sleep,100
		WinWaitActive,ahk_class Chrome_WidgetWin_1,,5
		sendinput,^{l}
		sleep,100
		sendinput,^v
		sleep,100
		sendinput,{enter}
		sleep,100
		Clipboard:=OldCP
	return
	}		
}

CustomPlugin_BrowserSwith_Firefox(){
	;获取当前浏览器
	CurWinClass:=QZData("winclass") ;将获取的class名赋值给用户变量
	Curhwnd:=QZData("hWnd")
	WinActivate,Ahk_ID %Curhwnd%
	sleep,100
	if (CurWinClass="MozillaWindowClass") or (CurWinClass="QQBrowser_WidgetWin_1") or (CurWinClass="Chrome_WidgetWin_1") ;如果当
	{
		OldCP:=Clipboard
		sendinput,!{d}
		sleep,200
		sendinput,^c
		sleep,200
	}
	if (CurWinClass="MozillaWindowClass") {
		AppPath:=QZData("%Firefox%")
		run,%AppPath%
		sleep,2000
		WinWaitActive,ahk_class MozillaWindowClass,,5
		sendinput,{F6}
		sleep,200
		sendinput,^v
		sleep,200
		sendinput,{enter}
		sleep,200
		Clipboard:=OldCP
	return
	}		
}
